<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>全局组件案例2</title>
    <script src="vue.js"></script>
    <style>
        .bar{
            list-style-type: none;
        }
    </style>
</head>
<body>
    <template id="t1">
       <div>
          <div>
              <img src="images/logo_text.png">
              <ul class="bar">
                  <li>培训首页</li>
                  <li>课程中心</li>
                  <li>蜗牛网校</li>
                  <li>企业内训</li>
                  <li>师资介绍</li>
                  <li>就业信息</li>
                  <li>关于我们</li>
              </ul>
          </div>
       </div>
       
    </template>
    <div id="app1" style="background-color: greenyellow;">
        <hello></hello>
        <hello></hello>
        <hello></hello>
    </div>

    <div id="app2" style="background-color: skyblue;margin-top: 200px;">
        <hello></hello>
        <hello></hello>
    </div>
</body>
</html>
<script>
    /*
      1.全局组件的位置:vue实例之前
    */
    Vue.component('hello',{
        template:'#t1',
        data:function(){
            return{
                name:'Giles'
            }
        }
    });
    var vm=new Vue({ 
        el:'#app1'
    });
    var vm=new Vue({ 
        el:'#app2'
    });
</script>